/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package xilinx;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
 *
 * @author dani
 */
public class InterfazJFrame extends javax.swing.JFrame {

    /**
     * Creates new form InterfazJFrame
     */
    public InterfazJFrame() {
        initComponents();
         jTextPaneA.setToolTipText( "<html>Estoy en primera linea<br>Y yo estoy en segunda linea</html>" );
         jTextPane8.setToolTipText( "<html>Estoy en primera linea<br>Y yo estoy en segunda linea</html>" );
         jTextPaneC.setToolTipText( "<html>Estoy en primera linea<br>Y yo estoy en segunda linea</html>" );
         jTextPaneP.setToolTipText( "<html>Estoy en primera linea<br>Y yo estoy en segunda linea</html>" );
         jTextPaneOPMODE.setToolTipText( "<html>Estoy en primera linea<br>Y yo estoy en segunda linea</html>" );
         jTextPanePCIN.setToolTipText( "<html>Estoy en primera linea<br>Y yo estoy en segunda linea</html>" );
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextPaneA = new javax.swing.JTextPane();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextPaneB = new javax.swing.JTextPane();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTextPaneC = new javax.swing.JTextPane();
        jLabel5 = new javax.swing.JLabel();
        jScrollPane4 = new javax.swing.JScrollPane();
        jTextPaneP = new javax.swing.JTextPane();
        jLabel6 = new javax.swing.JLabel();
        jScrollPane5 = new javax.swing.JScrollPane();
        jTextPanePCIN = new javax.swing.JTextPane();
        jSeparator1 = new javax.swing.JSeparator();
        label1 = new java.awt.Label();
        jTextFieldOperacion = new javax.swing.JTextField();
        jButtonOK = new javax.swing.JButton();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jScrollPane6 = new javax.swing.JScrollPane();
        jTextPane6 = new javax.swing.JTextPane();
        jScrollPane7 = new javax.swing.JScrollPane();
        jTextPane7 = new javax.swing.JTextPane();
        jScrollPane8 = new javax.swing.JScrollPane();
        jTextPane8 = new javax.swing.JTextPane();
        jLabel11 = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jLabel12 = new javax.swing.JLabel();
        jScrollPane9 = new javax.swing.JScrollPane();
        jTextPaneOPMODE = new javax.swing.JTextPane();
        jComboBox_potencia_A = new javax.swing.JComboBox();
        jComboBox_potencia_B = new javax.swing.JComboBox();
        jComboBox_potencia_C = new javax.swing.JComboBox();
        jComboBox_potencia_BCIN = new javax.swing.JComboBox();
        jComboBox_potencia_PCIN = new javax.swing.JComboBox();
        jLabel13 = new javax.swing.JLabel();
        jScrollPane10 = new javax.swing.JScrollPane();
        jTextPaneALUMODE = new javax.swing.JTextPane();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Proyecto fin de carrera");

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel1.setText("Entada de Datos");

        jLabel2.setText("A [17:0]");

        jLabel3.setText("B [17:0]");

        jLabel4.setText("C [47:0]");

        jTextPaneA.setToolTipText("");
        jScrollPane1.setViewportView(jTextPaneA);

        jScrollPane2.setViewportView(jTextPaneB);

        jScrollPane3.setViewportView(jTextPaneC);

        jLabel5.setText("P [17:0]");

        jScrollPane4.setViewportView(jTextPaneP);

        jLabel6.setText("PCIN [47.0]");

        jScrollPane5.setViewportView(jTextPanePCIN);

        jSeparator1.setBackground(new java.awt.Color(0, 153, 153));
        jSeparator1.setForeground(new java.awt.Color(153, 0, 153));
        jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);

        label1.setText("Operación ha realizar:");

        jButtonOK.setText("Ok");
        jButtonOK.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jButtonOKMousePressed(evt);
            }
        });

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel7.setText("Datos de Salida");

        jLabel8.setText("BCOUNT [17:0]");

        jLabel9.setText("PCOUNT [47:0]");

        jLabel10.setText("P [47:0]");

        jTextPane6.setEditable(false);
        jScrollPane6.setViewportView(jTextPane6);

        jTextPane7.setEditable(false);
        jScrollPane7.setViewportView(jTextPane7);

        jTextPane8.setEditable(false);
        jScrollPane8.setViewportView(jTextPane8);

        jLabel11.setText("OPMODE [6:0]");

        jLabel12.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel12.setText("Resultados");

        jScrollPane9.setViewportView(jTextPaneOPMODE);

        jComboBox_potencia_A.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Decimal", "Binario", "Octal", "Hexadecimal", "", "" }));

        jComboBox_potencia_B.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Decimal", "Binario", "Octal", "Hexadecimal" }));

        jComboBox_potencia_C.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Decimal", "Binario", "Octal", "Hexadecimal" }));

        jComboBox_potencia_BCIN.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Decimal", "Binario", "Hexadecimal" }));

        jComboBox_potencia_PCIN.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Decimal", "Binario", "Octal", "Hexadecimal" }));

        jLabel13.setText("ALUMODE [6:0]");

        jScrollPane10.setViewportView(jTextPaneALUMODE);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jTextFieldOperacion))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(57, 57, 57)
                                .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(72, 72, 72)
                                .addComponent(jButtonOK, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(40, 40, 40)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                                .addComponent(jLabel4)
                                                .addGap(18, 18, 18)
                                                .addComponent(jScrollPane3))
                                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                                .addComponent(jLabel3)
                                                .addGap(18, 18, 18)
                                                .addComponent(jScrollPane2))
                                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                                .addComponent(jLabel2)
                                                .addGap(18, 18, 18)
                                                .addComponent(jScrollPane1))
                                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                                .addGap(9, 9, 9)
                                                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                        .addGap(18, 18, Short.MAX_VALUE)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jComboBox_potencia_A, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jComboBox_potencia_C, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jComboBox_potencia_B, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addGroup(layout.createSequentialGroup()
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(jLabel5)
                                                .addGap(18, 18, 18)
                                                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(jLabel6)
                                                .addGap(18, 18, 18)
                                                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                        .addGap(26, 26, 26)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jComboBox_potencia_PCIN, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jComboBox_potencia_BCIN, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGap(0, 0, Short.MAX_VALUE)))))
                        .addGap(23, 23, 23)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addGap(36, 36, 36)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel9)
                                    .addComponent(jLabel8)
                                    .addComponent(jLabel10))
                                .addGap(24, 24, 24)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jScrollPane6)
                                    .addComponent(jScrollPane7, javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addGap(32, 32, 32)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel11)
                                    .addComponent(jLabel13))
                                .addGap(36, 36, 36)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addContainerGap())
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(82, 82, 82))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 336, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addContainerGap())
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel12)
                                .addGap(124, 124, 124))))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(32, 32, 32)
                .addComponent(jLabel1)
                .addGap(29, 29, 29)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jComboBox_potencia_A, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(26, 26, 26)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBox_potencia_B, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel4)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(30, 30, 30)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel5)
                            .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jComboBox_potencia_C, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(34, 34, 34)
                        .addComponent(jComboBox_potencia_BCIN, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(36, 36, 36)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jLabel6)
                        .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jComboBox_potencia_PCIN, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 116, Short.MAX_VALUE)
                .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(22, 22, 22)
                .addComponent(jTextFieldOperacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jButtonOK)
                .addContainerGap())
            .addComponent(jSeparator1)
            .addGroup(layout.createSequentialGroup()
                .addGap(35, 35, 35)
                .addComponent(jLabel7)
                .addGap(20, 20, 20)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel11)
                    .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(22, 22, 22)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel13)
                    .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel12)
                .addGap(30, 30, 30)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel8)
                            .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(37, 37, 37)
                        .addComponent(jLabel9))
                    .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(34, 34, 34)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel10)
                    .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(43, 43, 43))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonOKMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButtonOKMousePressed
        try {
            // TODO add your handling code here:
            accionBotonOK();
            
        } catch (Exception ex) {
            Logger.getLogger(InterfazJFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jButtonOKMousePressed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
             
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
 
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(InterfazJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(InterfazJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(InterfazJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(InterfazJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new InterfazJFrame().setVisible(true);
               
            }
        });


    }
    //variables
    // int valores de 32 bits maximo
    int valorDeA = 0;
    int valorDeB = 0;
    int valorDeC = 0;
    int[] Z = new int[3];
    int[] Y = new int[2];
    int[] X = new int[2];
    boolean operacion_AconB = false;
    boolean operacion_AxB = false;
    boolean operacion_PCIN = false;
    boolean operacion_CIN = false;
    boolean operacion_P = false;
    boolean operacion_P2 = false;
    boolean operacion_C = false;
    boolean operacion_C2 = false;
    boolean operacion_ShiftPCIN = false;
    boolean operacion_ShiftP = false;
    boolean error = false;
    
    // long valores de 64 bit maximo
    long valorDeP = 0;
    long valorDePCIN = 0;
    boolean activoCIN=false;
    String operacion="";
    
    boolean signoAconB;
    boolean signoAxB;
    boolean signoPCIN; 
    boolean signoCIN;
    boolean signoBCIN;
    String [] operandos;
    boolean signo[];
    
    public void rellenarOperandos()
    {
        operandos=new String[8];
        operandos[0]="AconB";
        operandos[1]="AxB";
        operandos[2]="CIN";
        operandos[3]="P";
        operandos[4]="C";
        operandos[5]="C2";
        operandos[6]="ShiftPCIN";
        operandos[7]="ShiftP";
    }
    
    public long cambioBase(String cadena, int limite, int potencia) throws Exception
    {
        try
        {
           boolean signo; //true positivo, false negativo 
           char signo2= cadena.charAt(0);
           double maximo=Math.pow(2, limite);
            if(cadena.length()<2 &&  potencia!=10)
               throw new Exception("El numero en representacion en complemento necesita al menos dos digitos");
        
            //Caso de decimal ya esta transformado
           if(potencia == 10)
           {
               if(Math.pow(2, limite)>Long.parseLong(cadena, potencia) &&(-1)*Math.pow(2, limite)<Long.parseLong(cadena, potencia) )
                 return  Long.parseLong(cadena, potencia);
               else
                  throw new Exception("la cadena de digitos sobrepasa el limite establecido para dicho registro"); 
           }
        //Caso de binario hay que transformalos a sistema decimal tener en cuenta que esta en sitema complemento a dos    
          if(potencia == 2)
          {
                if (signo2=='1')
                    signo=false;
                else
                    if (signo2=='0')
                         signo=true;
                    else
                         throw new Exception("El primer digito del numero tiene que corresponder con el signo");
                for(int i=0;i<cadena.length();i++) //comprobamos que la cadena esta formada por 0s y 1s 
                {
                    if(cadena.charAt(i)=='0' || cadena.charAt(i)=='1' )
                        continue;
                    else
                         throw new Exception("Los caracteres introducidos no corresponde con valores binarios"); 
                }  
                if(Math.pow(2, limite)>Long.parseLong(cadena, potencia) &&(-1)*Math.pow(2, limite)<Long.parseLong(cadena, potencia) )
                    if(signo)
                        return ( Long.parseLong(cadena, potencia));
                    else //lo convertimos a complemento a dos
                     {
                        String subcadena=cadena.substring(1,cadena.length());
                        return ( -Long.parseLong(subcadena, potencia)-1);
                     }
                else
                  throw new Exception("la cadena de digitos sobrepasa el limite establecido para dicho registro");   
            }  
        //Caso de Octal hay que transformalos a sistema decimal tener en cuenta que esta en sitema complemento  
            if(potencia == 8)
            {
                if (signo2=='7')
                    signo=false;
                else
                    if(signo2=='0')
                        signo=true;
                    else
                        throw new Exception("El primer digito del numero tiene que corresponder con el signo");

                for(int i=0;i<cadena.length();i++)     
                {
                    if(cadena.charAt(i)=='0' || cadena.charAt(i)=='1'|| cadena.charAt(i)=='2'|| cadena.charAt(i)=='3'
                    || cadena.charAt(i)=='4' || cadena.charAt(i)=='5'|| cadena.charAt(i)=='6'|| cadena.charAt(i)=='7')
                        continue;
                    else
                        throw new Exception("Los caracteres introducidos no corresponde con valores en representación octal"); 
                 }  
                if(Math.pow(2, limite )>Long.parseLong(cadena, potencia) &&(-1)*Math.pow(2, limite)<Long.parseLong(cadena, potencia) )
                    if(signo)
                        return ( Long.parseLong(cadena, potencia));
                    else //lo convertimos a complemento a dos
                        {
                            String subcadena=cadena.substring(1,cadena.length());
                            return ( -Long.parseLong(subcadena, potencia)-1);
                        }
                else
                  throw new Exception("la cadena de digitos sobrepasa el limite establecido para dicho registro"); 
               }
       //Caso de Hexadecimal hay que transformalos a sistema decimal tener en cuenta que esta en sitema complemento  
         if(potencia == 16)
           {
                if (signo2=='F')
                    signo=false;
                else
                    if(signo2=='0')
                        signo=true;
                    else
                        throw new Exception("El primer digito del numero tiene que corresponder con el signo");

                for(int i=0;i<cadena.length();i++)     
                {
                    if(cadena.charAt(i)=='0' || cadena.charAt(i)=='1'|| cadena.charAt(i)=='2'|| cadena.charAt(i)=='3'
                        || cadena.charAt(i)=='4' || cadena.charAt(i)=='5'|| cadena.charAt(i)=='6'|| cadena.charAt(i)=='7'
                        || cadena.charAt(i)=='8' || cadena.charAt(i)=='9'|| cadena.charAt(i)=='a'|| cadena.charAt(i)=='A'
                        || cadena.charAt(i)=='b' || cadena.charAt(i)=='B'|| cadena.charAt(i)=='c'|| cadena.charAt(i)=='C'
                        || cadena.charAt(i)=='e' || cadena.charAt(i)=='E'|| cadena.charAt(i)=='f'|| cadena.charAt(i)=='F')
                            continue;
                    else
                            throw new Exception("Los caracteres introducidos no corresponde con valores en representación hexadecimal"); 
                }  
                if(Math.pow(2, limite )>Long.parseLong(cadena, potencia) &&(-1)*Math.pow(2, limite)<Long.parseLong(cadena, potencia) )
                    if(signo)
                        return ( Long.parseLong(cadena, potencia));
                    else //lo convertimos a complemento a dos
                    {
                        String subcadena=cadena.substring(1,cadena.length());
                        return ( -Long.parseLong(subcadena, potencia)-1);
                    }
                else
                  throw new Exception("la cadena de digitos sobrepasa el limite establecido para dicho registro"); 
            }  
          }
        catch(Exception e)
        {
            System.out.println(e.toString());
        }
        return 0;
    }
    
    public int obtenerPotencia(String valor)
    {
        int potencia=0;
            switch(valor)
        {
            case "Hexadecimal":{potencia=16; break;}
            case "Binario":{potencia=2; break;}
            case "Decimal":{potencia=10; break;}
            case "Octal":{potencia=8; break;}
        }
            return potencia;
    }
    
    
    
    
    
    //valor de A tiene la restriccion de 
    public void obtenerValorDeA() throws Exception
    {  
        int potenciaA;
        int limite=30;
        String  valor=jComboBox_potencia_A.getSelectedItem().toString();
        potenciaA=obtenerPotencia(valor);
        valorDeA = (int) (long)cambioBase(jTextPaneA.getText(),limite,potenciaA);
        System.out.println("valor de A: "+valorDeA);
    }
    
     //valor de B tiene la restriccion de 
    public void obtenerValorDeB() throws Exception
    {
        // valorDeB =(int) (long)cambioBaseHexadecimal(jTextPaneB.getText(),18);
        int potenciaB;
        int limite=18;
        String  valor=jComboBox_potencia_B.getSelectedItem().toString();
        potenciaB=obtenerPotencia(valor);
        valorDeB = (int) (long)cambioBase(jTextPaneB.getText(),limite,potenciaB);
        System.out.println("valor de B: "+valorDeB);
    }
     //valor de C tiene la restriccion de 
    public  void obtenerValorDeC() throws Exception
    {
        //valorDeC =(int) (long)cambioBaseHexadecimal(jTextPaneC.getText(),18);
        int potenciaC;
        int limite=48;
        String  valor=jComboBox_potencia_C.getSelectedItem().toString();
        potenciaC=obtenerPotencia(valor);
        valorDeC = (int) (long)cambioBase(jTextPaneC.getText(),limite,potenciaC);
        System.out.println("valor de C: "+valorDeC);
    }
   
     //valor de CIN tiene la restriccion de 
 /*   public  void obtenerValorDeCIN() 
    {
        activoCIN = jCheckBoxCIN.isSelected();      
    }*/
     //valor de P tiene la restriccion de 
    public void obtenerValorDeP() throws Exception
    {
        //valorDeBCIN = cambioBaseHexadecimal(jTextPaneBCIN.getText(),32);
        int potenciaP;
        int limite=18;
        String  valor=jComboBox_potencia_BCIN.getSelectedItem().toString();
        potenciaP=obtenerPotencia(valor);
        valorDeP = (int) (long)cambioBase(jTextPaneP.getText(),limite,potenciaP);
        System.out.println("valor de BCIN: "+valorDeP);
    }
    
    
         //valor de PCIN tiene la restriccion de 
    public void obtenerValorDePCIN() throws Exception
    {
        //valorDeBPCIN = cambioBaseHexadecimal(jTextPaneBCIN.getText(),32);
        int potenciaPCIN;
        int limite=18;
        String  valor=jComboBox_potencia_PCIN.getSelectedItem().toString();
        potenciaPCIN=obtenerPotencia(valor);
        valorDePCIN = (int) (long)cambioBase(jTextPaneP.getText(),limite,potenciaPCIN);
        System.out.println("valor de BCIN: "+valorDePCIN);
    }
    
    public void obtenerEntradas() throws Exception
    {
        obtenerValorDeA();
        obtenerValorDeB();
        obtenerValorDeC();
        obtenerValorDeP();
        obtenerValorDePCIN();
    }
    
    
    
    
    public void mostarValor(int valor) 
    {
        jTextPaneOPMODE.setText(""+valor);
    }
    
    public void obtenerCadena()
    {
        operacion=jTextFieldOperacion.getText();
    }
    public void reset()
    {
        valorDeA = 0;
        valorDeB = 0;
        valorDeC = 0;
        Z[0]=0;Z[1]=0;Z[2]=0;
        Y[0]=0;Y[1]=0;
        X[0]=0;X[1]=0;
        operacion_AconB = false;
        operacion_AxB = false;
        operacion_PCIN = false;
        operacion_CIN = false;
        operacion_P = false;
        operacion_P2 = false;
        operacion_C = false;
        operacion_C2 = false;
        operacion_ShiftPCIN = false;
        operacion_ShiftP = false;
        signo=new boolean[7];
        for(int i=0; i<signo.length;i++)
            signo[i]=true;
    }
    
    
    public void reconocedor(String cadena)
    {
        reset();
        obtenerCadena();
        StringTokenizer tokens = new StringTokenizer(cadena," +-()",true);
        while(tokens.hasMoreTokens()){
            String token=tokens.nextToken();
            System.out.println(token);
            
            if(token.equals("CIN")) 
                   if(!operacion_CIN)
                         operacion_CIN = true;
                   else
                         error = true;
            if(token.equals("PCIN")) 
                   if(!operacion_PCIN)
                         operacion_PCIN = true;
                   else
                         error = true;
            if(token.equals("P"))
                if(!operacion_P)
                    operacion_P = true;
                else
                    if(operacion_P && !operacion_P2)
                        operacion_P2=true;
                    else
                        error =true;
            if(token.equals("C"))
                if(!operacion_C)
                     operacion_C = true;
                else
                    if(operacion_C && !operacion_C2)
                        operacion_C2=true;
                    else
                        error =true;
            if(token.equals("Shirf(P)"))
                if(!operacion_ShiftP)
                    operacion_ShiftP = true;
                else
                    error=true;
            if(token.equals("Shirf(PCIN)"))
                
                if(!operacion_ShiftPCIN)
                     operacion_ShiftPCIN = true;
                else
                    error=true;
            
            if(token.equals("AxB") || token.equals("A×B"))
                if(!operacion_AxB)
                     operacion_AxB = true;
                else
                    error=true;  
            if(token.equals("A:B"))
                if(!operacion_AconB)
                     operacion_AconB = true;
                else
                    error=true;             
        }
        
        System.out.println(operacion);
        generadorOPMODE();
    }
    

    
    
    
    
    public void generadorOPMODE()
    {
        //configuracion del multiplexor Z
        /*  if(operacion_CIN && !operacion_PCIN  && !operacion_ShiftPCIN && !operacion_ShiftP)
              Z[2]=0; Z[1]=0; Z[0]=0; //valor de Z = Zero
          if(operacion_PCIN  && !operacion_ShiftPCIN && !operacion_ShiftP)
              Z[2]=0; Z[1]=0; Z[0]=1; //valor de Z = PCIN
          if(operacion_P  && !operacion_PCIN && !operacion_ShiftPCIN && !operacion_ShiftP)
              Z[2]=0; Z[1]=1; Z[0]=0; //valor de Z = P
          if(operacion_C  && !operacion_PCIN  && !operacion_ShiftPCIN && !operacion_ShiftP)
              Z[2]=0; Z[1]=1; Z[0]=1; //valor de Z = C    
          if(operacion_ShiftPCIN && !operacion_PCIN  && !operacion_ShiftP)
              Z[2]=1; Z[1]=0; Z[0]=1; //valor de Z = ShiftPCIN
          if(operacion_ShiftP && !operacion_PCIN  && !operacion_ShiftPCIN)
              Z[2]=1; Z[1]=0; Z[0]=1; //valor de Z = ShiftPCIN
           //configuracion del multiplexor X e Y 
           */
        localizarPrimerOperando();
        localizarSegundoOperando();
    }
        public void localizarPrimerOperando()
    {
        //con el primer operando determinamos la logica de control del multiplexor Z
        String primerOperando="Zero";
        
            if(operacion_PCIN && !operacion_ShiftPCIN && !operacion_ShiftP)
            {
                primerOperando = "PCIN";
                operacion_PCIN=false;
                Z[2]=0;Z[1]=0;Z[0]=1;
            }
            else
               if(operacion_ShiftPCIN && !operacion_PCIN && !operacion_ShiftP)
               {
                   primerOperando = "Shift(PCIN)";
                   Z[2]=1;Z[1]=0;Z[0]=1;
                   operacion_ShiftPCIN=false;
               }
               else
                 if(operacion_ShiftP && !operacion_PCIN && !operacion_ShiftPCIN)
                 {
                     primerOperando = "Shift(P)";
                     Z[2]=1;Z[1]=1;Z[0]=0;
                     operacion_ShiftP=false;
                 }
                 else
                    if(!operacion_ShiftP && !operacion_PCIN && !operacion_ShiftPCIN && operacion_P2 && !operacion_C2)
                    {
                        primerOperando = "P";
                        Z[2]=0;Z[1]=1;Z[0]=0;
                        operacion_P2=false;
                    }
                     else
                       if(!operacion_ShiftP && !operacion_PCIN && !operacion_ShiftPCIN && operacion_C2 && !operacion_P2)
                       {
                           primerOperando = "C";
                           Z[2]=0;Z[1]=1;Z[0]=1;
                           operacion_C2=false;
                       }
                       else
                         if(!operacion_ShiftP && !operacion_PCIN && !operacion_ShiftPCIN && !operacion_P2 && !operacion_C2 &&  operacion_P && !operacion_C)
                        {
                                primerOperando = "P";
                                Z[2]=0;Z[1]=1;Z[0]=0;
                                operacion_P=false;
                        }
                         else
                            if(!operacion_ShiftP && !operacion_PCIN && !operacion_ShiftPCIN && !operacion_C2 && !operacion_P2&& operacion_C && !operacion_P)
                            {
                                primerOperando = "C";
                                Z[2]=0;Z[1]=1;Z[0]=1;
                                operacion_C=false;
                            }

                            else
                               {
                                  primerOperando = "Zero";
                                  Z[2]=0;Z[1]=0;Z[0]=0;
                               } 
    }
    
    
    
     public void localizarSegundoOperando()
     {
          //localizamos el segundo operando que nos da los valores de los multiplexores X e Y    
          if(operacion_CIN && !operacion_P  && !operacion_AconB && !operacion_AxB ) //(CIN)
          { 
              Y[1]=0; Y[0]=0;//valor de Y = 0
              X[1]=0; X[0]=0; //valor de X = 0
          }
          if(operacion_CIN && operacion_P && !operacion_AconB && !operacion_AxB ) //(P + CIN)
          {
              Y[1]=0; Y[0]=0;//valor de Y = 0
              X[1]=0; X[0]=0;//valor de X = P
          }
          if(operacion_CIN && operacion_AconB && !operacion_AxB) //(A:B + CIN)
          {
              Y[1]=0; Y[0]=0;//valor de Y = 0
              X[1]=1; X[0]=1;//valor de X = A:B
          }      
          if(operacion_CIN && operacion_AxB)//(AxB + CIN)
          {
              Y[1]=0; Y[0]=1;
              X[1]=0; X[0]=1;
          }  
          if(operacion_CIN && operacion_C && !operacion_AconB) //(C + CIN)
          {
              Y[1]=1; Y[0]=1; //valor de Y = C
              X[1]=0; X[0]=0; //valor de X = 0
          }  
          if(operacion_CIN && operacion_C && operacion_P && !operacion_AconB && !operacion_AxB) //(C + P + CIN)
          {
              Y[1]=1; Y[0]=1;//valor de Y = C
              X[1]=1; X[0]=0;//valor de X = P
          } 
          if(operacion_CIN && operacion_C && operacion_P && !operacion_AxB) //(A:B + C + CIN)
          {
              Y[1]=1; Y[0]=1;//valor de Y = C
              X[1]=1; X[0]=0;//valor de Z = A:B
          } 
          System.out.println("Valor de OPMODE: "+Z[2]+Z[1]+Z[0]+Y[1]+Y[0]+X[1]+X[0]);
          
          
    }
    
    public void accionBotonOK() throws Exception
    {
        obtenerEntradas();
        obtenerCadena();
        reconocedor(operacion);

    }
      

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.JButton jButtonOK;
    private javax.swing.JComboBox jComboBox_potencia_A;
    private javax.swing.JComboBox jComboBox_potencia_B;
    private javax.swing.JComboBox jComboBox_potencia_BCIN;
    private javax.swing.JComboBox jComboBox_potencia_C;
    private javax.swing.JComboBox jComboBox_potencia_PCIN;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane10;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JTextField jTextFieldOperacion;
    private javax.swing.JTextPane jTextPane6;
    private javax.swing.JTextPane jTextPane7;
    private javax.swing.JTextPane jTextPane8;
    private javax.swing.JTextPane jTextPaneA;
    private javax.swing.JTextPane jTextPaneALUMODE;
    private javax.swing.JTextPane jTextPaneB;
    private javax.swing.JTextPane jTextPaneC;
    private javax.swing.JTextPane jTextPaneOPMODE;
    private javax.swing.JTextPane jTextPaneP;
    private javax.swing.JTextPane jTextPanePCIN;
    private java.awt.Label label1;
    // End of variables declaration//GEN-END:variables
}
